﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sort
{
    class Program
    {
        static void Main(string[] args)
        {
            int size = 20000;
            int[] list = new int[size];
            Random rd = new Random();
            for (int j = 0; j < size; j++)
            {
                list[j] = rd.Next(100);
            }

            int[][] data = new int[10][];
            for (int i = 0; i < 10; i++)
            {
                data[i] = new int[size];
                Buffer.BlockCopy(list, 0, data[i], 0, size * sizeof(int));
            }


            Utils.CheckRunTime(() =>
            {
                ShellSort.Sort(data[0]);
            }, "sell sort ");

            Utils.CheckRunTime(() =>
            {
                InsertSort.Sort(data[1]);
            }, "InsertSort sort ");

            Utils.CheckRunTime(() =>
            {
                QSort.Sort(data[2], 0, data[2].Length - 1);
            }, "QSort sort ");

            Utils.CheckRunTime(() =>
            {
                BubbleSort.Sort(data[3]);
            }, "BubbleSort sort ");

            Utils.CheckRunTime(() =>
            {
                SelectionSort.Sort(data[4]);
            }, "SelectionSort sort ");

            Utils.CheckRunTime(() =>
            {
                HeapSort.Sort(data[5]);
            }, "HeapSort sort ");

            Utils.CheckRunTime(() =>
            {
                MergeSort.Sort(data[6]);
            }, "MergeSort sort ");

            Utils.CheckRunTime(() =>
            {
                RadixSort.Sort(data[7]);
            }, "RadixSort");


            for (int i = 0; i < 10; i++)
            {
                if (!Utils.CheckOrderArray(data[i]))
                {
                    Console.WriteLine(i + " error.");
                }
            }
        }
    }
}
